package com.translate.web.api.controller;

import java.util.List;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.param.impl.IdParam;
import com.response.vo.ResponseModel;
import com.translate.vo.ScientificVO;
import com.translate.web.service.IScientificService;

@RestController
@RequestMapping("scientific")
public class ScientificController {
	private IScientificService service;

	public ScientificController(IScientificService service) {
		this.service = service;
	}
	
	/**
	 * 活动
	 * @param param
	 * @return
	 */
	@PostMapping("/listScientifics")
	public ResponseModel<List<ScientificVO>> listScientifics() {
		
		return ResponseModel.<List<ScientificVO>>success(this.service.getListFromCache(ScientificVO.class));
	}
	
	/**
	 * 活动文章
	 * @param param
	 * @return
	 */
	@PostMapping("/getArticle")
	public ResponseModel<ScientificVO> getArticleById(@RequestBody @Validated IdParam param) {
		
		return ResponseModel.<ScientificVO>success(this.service.getArticleById(param.getId(), ScientificVO.class));
	}

}